package com.linjiahao.servicebase.common;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;

@Getter
public enum NettyMessageType {

    ADD_FRIEND(1,"添加好友消息","add_friend"),
    ADD_FRIEND_FISH(2,"好友申请成功","add_friend"),
    CURRENT_FRIEND_CHAT_LIST(3,"获取好友聊天列表","current_cha_list"),
    FRIEND_CHAT_MESSAGE(4,"获取历史聊天列表","friend_chat_message"),
    SINGLE_MESSAGE(5,"单聊","single_message"),
    ADD_CHAT_LIST(7,"聊天列表添加","add_chat_list"),
    ;
    public  Integer type;
    public String message;
    public String handleName;

    NettyMessageType(Integer type,String message,String handleName){
        this.type = type;
        this.message = message;
        this.handleName = handleName;
    }

    public static String getHandleNameByType(Integer type){
        List<NettyMessageType> messageTypes = Arrays.asList(NettyMessageType.values());
        NettyMessageType nettyMessageType = messageTypes.stream().filter(m -> m.getType().equals(type)).findFirst().get();
        return nettyMessageType.getHandleName();
    }
}
